# -*- coding: utf-8 -*-

import os

# Django settings for mydjango project.

DEBUG = False
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)

MANAGERS = ADMINS

### for reCAPTCHA ############################################
RECAPTCHA_PUBLIC_KEY = '6Ld1x-ASAAAAAL76iOgsfF4O6acrbwus95mngAfQ'
RECAPTCHA_PRIVATE_KEY = '6Ld1x-ASAAAAALu_n4yyWV1OwrQy51OmJ7MXxzpu'
### for reCAPTCHA ############################################

### for sending e-mail via gmail in django ##################################
EMAIL_BACKEND = 'appengine_emailbackend.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'no_reply@taipeimarathon.net'
EMAIL_HOST_PASSWORD = '5krunql31j4'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = '5krun<' + 'no_reply@taipeimarathon.net' + '>'
### for sending e-mail via gmail in django ##################################  

# for google apap engine
BASE_DIR = os.path.abspath(os.path.dirname(__file__)) + os.sep

DATABASES = {
    'default': {
		'ENGINE': 'google.appengine.ext.django.backends.rdbms',
        'INSTANCE': 'project5krun:db5krun',
        'NAME': 'djangodb',
        # 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        # 'NAME': '',                      # Or path to database file if using sqlite3.
        # 'USER': '',                      # Not used with sqlite3.
        # 'PASSWORD': '',                  # Not used with sqlite3.
        # 'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        # 'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}

TEMPLATE_CONTEXT_PROCESSORS = (
                               'django.contrib.auth.context_processors.auth',
                               'django.core.context_processors.debug',
                               'django.core.context_processors.i18n',
                               'django.core.context_processors.media',
                               'django.core.context_processors.static',
                               'django.core.context_processors.request',
)

### for message framework ###############################################
TEMPLATE_CONTEXT_PROCESSORS += ('django.contrib.messages.context_processors.messages',)
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
### for message framework ###############################################

### for django-cms #########################################################
TEMPLATE_CONTEXT_PROCESSORS += (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.i18n',
    'django.core.context_processors.request',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'cms.context_processors.media',
    'sekizai.context_processors.sekizai',
)

CMS_TEMPLATES = (
    ('template_Home.html', 'Template Home'),
    ('template_EventMain.html', 'Template EventMain'),
    ('template_EventDescript.html', 'Template Event Description page'),
    ('template_News.html', 'Template News'),
    ('template_AboutUs.html', 'Template About Us'),
    ('template_User.html', 'Template User'),
)

### for django-cms #########################################################
''' 
   language key string must be in lower case and separated by '-'
'''
LANGUAGES = [
    ('en', 'English'),
    ('zh-tw', 'Chinese(Traditional)'),
]

LOCALE_PATHS = (
    os.path.join(BASE_DIR, 'events/locale'),
    os.path.join(BASE_DIR, 'users/locale'),
    os.path.join(BASE_DIR, 'templates/5krun/locale'),
)


# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE='Asia/Taipei'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
### for django-cms #########################################################
# MEDIA_ROOT = ''
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
### for django-cms #########################################################


# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
# MEDIA_URL = ''
MEDIA_URL = '/media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
### for django-cms #########################################################
#STATIC_ROOT = ''
#STATIC_ROOT = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")
### for django-cms #########################################################

APPEND_SLASH=False

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(BASE_DIR, 'django_admin_bootstrapped/static/'),
    os.path.join(BASE_DIR, 'cms/static/'),
    os.path.join(BASE_DIR, 'cmsplugin_filer_folder/static/'),
    #os.path.join(BASE_DIR, 'dajaxice/templates'),
    os.path.join(BASE_DIR, 'filer/static/'),
    os.path.join(BASE_DIR, 'staticdev/'),
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
    
    ### for dajaxice #######################################
    'dajaxice.finders.DajaxiceFinder',
    ### for dajaxice #######################################
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = ')vd)n0gs=jn7p5sqh%h+ebj0w^7j1+i^0&fu-i-q4hoif#4xfc'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    
    ### for dajaxice ########################################
    'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    # the following middlewares are order matter
    'django.contrib.sessions.middleware.SessionMiddleware',
    #'django.middleware.cache.CacheMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    
    # # django debug tool bar
    # 'debug_toolbar.middleware.DebugToolbarMiddleware',

    ### for django-cms #########################################################
    # # this middleware will attach language slug into url  
    # 'cms.middleware.multilingual.MultilingualURLMiddleware',
    'cms.middleware.page.CurrentPageMiddleware',
    'cms.middleware.user.CurrentUserMiddleware',
    'cms.middleware.toolbar.ToolbarMiddleware',
    ### for django-cms #########################################################
)

ROOT_URLCONF = 'urls'


TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    
    os.path.join(BASE_DIR, "templates/5krun"),
	)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    
    'dajaxice',
    
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # for django admin bootstrap ##########
    'django_admin_bootstrapped',
    # for django admin bootstrap ##########
	'django.contrib.admin',
    
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
    
    # # debug django tool bar
    # 'debug_toolbar',
    
    'records',
    'users',
    'events',
    'legal',
    
    'captcha',
    
    ### for django-cms #########################################################
    'PIL',  # for easy_thumbnails, MUST in upper case
    'cms',
    'mptt',
    'menus',
    'south',
    'sekizai',
    'cms.plugins.flash',
    'cms.plugins.googlemap',
    'cms.plugins.text',
    'cms.plugins.twitter',
    
    'filer',
    'easy_thumbnails',
    'cmsplugin_filer_file',
    'cmsplugin_filer_folder',
    'cmsplugin_filer_image',
    'cmsplugin_filer_teaser',
    'cmsplugin_filer_video',
    'cmsplugin_filer_link',
    'cmsplugin_filer_utils',
    
    # 'reversion',
    ### for django-cms #########################################################
)

### for longer username and email ######################
# should always be the first at installed apps
INSTALLED_APPS = ('longerusernameandemail',) + INSTALLED_APPS 
### for longer username and email ######################

TEMP_NO_CAPTCHA = True

### this is for django-debug-toolbar ######################################################
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
# LOGGING = {
#    'version': 1,
#    'disable_existing_loggers': False,
#    'formatters': {
#                   'verbose': {'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'},
#                   'simple': {'format': '%(levelname)s %(message)s'},
#                   },
#    'handlers': {
#                 'mail_admins': {
#                                 'level': 'ERROR',
#                                 'class': 'django.utils.log.AdminEmailHandler'
#                                 },
#                 'console': {
#                             'level':'DEBUG',
#                             'class': 'logging.StreamHandler',
#                             'formatter':'simple'
#                             },
#                 },
#    'loggers': {
#                'django.request': {
#                                   'handlers': ['mail_admins'],
#                                   'level': 'ERROR',
#                                   'propagate': True,
#                                   },
#                'django': {
#                           'handlers':['file'],
#                           'level':'DEBUG',
#                           'propagate':True,
#                           },
#                }
# }

# INTERNAL_IPS = ('127.0.0.1',)
#
# if DEBUG:
#    # make all loggers use the console.
#    for logger in LOGGING['loggers']:
#        LOGGING['loggers'][logger]['handlers'] = ['console']
### end of django-debug-toolbar ##############################################################


try:
    from local_settings import *
except ImportError, e:
    pass
